import 'package:flutter/material.dart';
 
 
 /// 绘制三角形
 
class TrianglePainter extends CustomPainter{
 
  Color color; //填充颜色
  Paint _paint;//画笔
  Path _path;  //绘制路径
  double angle;//角度
 
  TrianglePainter(this.color){
   _paint = Paint()
       ..strokeWidth = 1.0 //线宽
       ..color = color
       ..isAntiAlias = true;
   _path = Path();
  }
 
  @override
  void paint(Canvas canvas, Size size) {
    // TODO: implement paint
    // final baseX = size.width * 0.1;
    // final baseY = size.height * 0.1;
    //起点
    _path.moveTo(size.width,0);
    _path.lineTo(size.width/2,size.height/2);
    _path.lineTo(0,0);
    canvas.drawPath(_path,_paint);
  }
 
  @override
  bool shouldRepaint(CustomPainter oldDelegate) {
    // TODO: implement shouldRepaint
    return false;
  }
 
}